home *** CD-ROM | disk | FTP | other *** search
- Prologue
- --------
-
- There's a lot of window'ish packages around. So, i'll dub this one
- Yet Another Windows, or YAW for short.
-
- I find it very difficult to work for free. But feel that these
- functions could be quite usefull to many others. So, a compromise,
- you may use this partial library in any of your programs. But, for
- the source, I request a minimal fee. And copyrights, well i'll
- retain these.
-
- For those without source code, you must use w_co(), w_putchar() and
- w_puts() for character output. And you may find it difficult to make
- your printf operate under these windows.
-
- This library and documentation is for those without the source
- code, and is incomplete.
-
- These funcions operate on the PC color graphics card, the monochrome
- card or their equivalents. Recognition of card type is automatic.
-
- The acceptable video modes are co80 and bw80. If video is not in
- either of these modes, it will be set to co80.
-
- The special window w_screen maps the physical screen. When no
- windows are open this is the output device. It behaves just like a
- normal screen. But as the current device it can be operated on as
- a window execept it must not be closed, moved or located. It's
- attributes can be changed for special effects.
-
- These functions and globals are prefixed by s_ or w_. The s_
- objects deal with the physical screen, and their functions are
- written in assembly. The w_ objects handle logic level windowing
- and the functions are written in C.
-
- The following describes the functions and globals you may use in
- your programs.
-
- Format this as you please.
-
-
-
- The Globals
- -----------
-
- char s_attr
-
- s_attr is the color of all output.
-
- unsigned s_curtype
-
- s_curtype is the default cursor type. It's value is a PC cursor
- type code.
-
- char s_curstat
-
- s_curstat is true if the cursor and should be moved.
-
- char (*w_open_frame)[]
-
- w_open_frame points to a character array containing the character
- set to be used for a window's frame when the window is opened. If
- zero no frame surrounds the window.
-
- char (*w_explode_frame)[]
-
- w_explode_frame points to the character set to be used for
- explosions. If zero no explosions occur.
-
- char w_attr_frame
-
- Color used for open frames and explosions.
-
-
- char w_single_frame[], w_double_frame[], w_mix_frame[], w_bold_frame[]
-
- A couple of frame character sets.
-
-
- int w_exp_delay
-
- Delay constant used to control explosion speed.
-
- int w_exp_frame
-
- Count of frames per explosion.
-
-
- The Functions
- -------------
-
- typedef struct window *WP ; /* the handle is pointer to struct */
-
-
- w_setup()
-
- synopsis: void w_setup()
-
- example: w_setup() ;
-
- Must be called before any other w_ or s_ call is made. Make this
- your first call in main. This function determins what type of
- video board is in use, color or mono, assures the mode is bw80 or
- co80. And also replaces the DOS critical error handler, with a
- windowed version.
-
-
- w_open()
-
- synopsis: WP w_open( top_row, top_col, bottom_row, bottom_col )
- int top_row, top_col, bottom_row, bottom_col ;
-
- example: WP w1 ;
- w1 = w_open( 5, 5, 10, 10 ) ;
-
- w_open() will open a window as the active consol output device.
- It's arguments define the area of the screen to be used by the
- window. The arguments are row of top left corner of window, column
- of top left corner, row of bottom right corner and column of bottom
- right corner. It returns a handle which must be used to identify
- this window to other functions. Or it returns 0 when out of free
- memory. If sucessfull, the window explodes on the screen.
- The default values s_attr, s_curtype and s_curstat are copied to
- the window. The area within the frame will be blanked. And the
- cursor will be positioned in the top left corner within the frame.
- Note well, there is no error check for bad arguments. A call with
- arguments out of order or bounds produces unknown results. There
- is no other limit on the number of windows concurrently open.
-
- eg.
- s_attr = 10 ; /* set the windows color now */
- s_curtype = 0x0607 ; /* it's cursor type */
- s_curstat = 1 ; /* cursor should be on */
- w = w_open( 10, 20, 20, 60 ) ; /* open it */
-
- Note the usage of globals as above, allows simpler calling
- conventions. Programming is thus easier, except when multiple
- coloring or cursor changes occur. Which is not that often.
-
-
- w_title()
-
- synopsis: void w_title( string )
- char *string ;
-
- example: w_title( "[ TITLE ]" ) ;
-
- w_title() will center a title string on the current window's top frame
- border. It's color is the default color. Commomly called just after a
- w_open().
-
-
- w_close()
-
- synopsis: void w_close( w )
- WP w ;
-
- example: WP w1 ;
- w_close( w1 ) ;
-
-
- w_close() will remove a window from the screen, and free the memory
- used by it. If the window is the current output window, the
- previous output window will be activated. No output to this window
- should follow.
-
-
- w_closeall()
-
- synopsis: void w_closeall()
-
- example: w_closeall() ;
-
- w_closeall() will close all windows currently open.
-
-
- w_active()
-
- synopsis: void w_active( w )
- WP w ;
-
- example: WP w1 ;
- w_active( w1 ) ;
-
- w_active() will make the specified window the current window. If
- this window is covered by other windows, it will be uncovered. The
- default color will be set to this windows default. The cursor, if
- on in this window will be turned on, and will be positioned to the
- current location in this window.
-
-
- w_locate()
-
- synopsis: void w_locate( row, col )
- int row, col ;
-
- example: w_locate( 10, 30 ) ;
-
-
- w_locate() will relocate the entire current window. It's arguments
- are the new upper left corner row and column coordinates. No
- boundary checks are made. Out of bound moves produce unknown
- result.
-
-
- w_move()
-
- synopsis: void w_move( dir )
- int dir ;
-
- example: w_move( 1 ) ;
-
- w_move() will move the current window one character space in the
- specified direction. The directions are :
-
- 1 1 up
- 4 X 2 2 right
- 3 3 down
- 4 left
-
- Only arguments of 1 through 4 valid. The function does a boundary
- check so that only movements within the screen ( w_screen ) are
- performed. Out of bounds movements are ignored.
-
-
-
-
-
-
- Functions which Operate on a Window's Workspace
- -----------------------------------------------
- The workspace of a window is the area within the windows frame.
-
-
- w_cursoff()
-
- synopsis: void w_cursoff()
-
- w_cursoff() will turn the cursor off in the current window only.
-
-
- w_curson()
-
- synopsis: void w_curson()
-
- w_curson() will restore the current window's cursor.
-
-
- w_rowcol()
-
- synopsis: void w_rowcol( row, col )
- int row, col ;
-
- example: w_rowcol( 2, 1 ) ;
-
- w_rowcol() will position the cursor within the current window. The
- top left corner of the window's workspace is 0, 0 . No boundary
- checks are performed.
-
-
- w_getrowcol()
-
- synopsis: void w_getrowcol( prow, pcol )
- int *prow, *pcol ;
-
- example: int r, c ;
- w_getrowcol( &r, &c ) ;
-
- w_getrowcol() reads the current window's cursor position. It assumes
- 0, 0 is the top left corner of the current window's workspace.
-
-
- w_clr()
-
- synopsis: void w_clr()
-
- w_clr() will clear the current window's workspace and position the
- cursor to the top left corner.
-
-
- w_color()
-
- synopsis: void w_color( attr )
- char attr ;
-
- example: w_color( 7 ) ;
-
- w_color() will color the entire current window's workspace. No
- characters are changed only attributes. The color becomes this
- window's default color. It's argument is a PC color code.
-
-
- w_co()
-
- synopsis: void w_co( c )
- char c ;
-
- example: w_co( 'A' ) ;
-
- w_co() is simular to your old co(). Except character output is
- confined to the current window's workspace and all characters are
- s_attr in color. Output can not be redirected.
-
-
- w_putchar()
-
- synopsis: void w_putchar( c )
- char c ;
-
- example: w_putchar( '\n' ) ;
-
- w_putchar() is likewise simular to putchar(). Except output is
- through w_co() and thus restritced to the current window.
-
-
- w_puts()
-
- synopsis: void w_puts( s )
- char *s ;
-
- example: w_puts( "hello world" ) ;
-
- w_puts() is again simular to puts(). Except output is through
- w_putchar() and is so restricted.
-
-
- w_center()
-
- synopsis: void w_center( s )
- char *s ;
-
- example: w_center( "hello world" ) ;
-
- w_center() will center the string in the current window on the
- current line.
-
-
-
-
-
-
- Others
- ------
-
- w_error()
-
- synopsis: void w_error( actions, message1, message2 )
- int actions ;
- char *message1, message2 ;
-
- example: w_error( ERR_ARI, "Can't Open File", "CUSTOMERS.DAT" ) ;
-
- w_error() is a "general purpose error message handler". It pops a
- window and displays the first message string, and a second message
- ( if message2 is non zero ). The actions of ABORT, RETRY and
- IGNORE are available, and are specified by the parameter actions.
- This function is also used by the DOS critical error handler
- replacement.
-
-
-
- Epilogue
- --------
-
- I stripped these functions out of a data base written long ago
- ('83 ). So, if memory serves me well, the above is enough to get
- you by. But should you find i've left something out or be in
- error, i'm sure you'll let me know.
-
- Enjoy it. ( while you can )
- Mark Feeney.
-